package com.biz;

import java.util.*;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.biz.*;
import com.po.*;
import com.services.daoServices;
import com.dao.*;
@Service("UsersBiz")
@Transactional
public class UsersBiz implements IUsersBiz {
	@Resource(name="daoServices")
	private daoServices daoServices;
	
	public daoServices getDaoServices() {
		return daoServices;
	}

	public void setDaoServices(daoServices daoServices) {
		this.daoServices = daoServices;
	}

	public boolean save(Users us) {
		try {
			daoServices.getUsersDAO().save(us);
			return true;
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return false;
	}

	public boolean update(Users us) {
		try {
			daoServices.getUsersDAO().merge(us);
			return true;
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return false;
	}

	public boolean delById(Integer id) {
		daoServices.getUsersDAO().delete(daoServices.getUsersDAO().findById(id));
		return false;
	}

	public Users findById(Integer id) {
		
		return daoServices.getUsersDAO().findById(id);
	}

	public List<Users> findAll() {
	
		return daoServices.getUsersDAO().findAll();
	}

	public Users check(Users us) {
		if(us==null){
			return null;
		}
		return daoServices.getUsersDAO().check(us);
	}

}
